<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目报价版支付表信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div id="pageInTab" class="pageInTab">
			<div tabid="tabA" title="基本信息" lselected="true">
	            <form id="formSet1">
	                <div class="fieldset1 tabel_col clearFix">
	                    <div class="fieldBox col_33">
		                    <div class="label">支付表号</div>
		                    <div class="field">
		                     <span id="paySchNo" name="paySchNo"></span>
		                   <input name="prjId" id="prjId" type="hidden" class="ui-textbox"   value="${prjId}" >
		                   <input name="prjPrdQuatId" id="prjPrdQuatId" type="hidden" class="ui-textbox"   value="${id}" >
		                    <input name="prjPrdDtlId" id="prjPrdDtlId" type="hidden" class="ui-textbox"   value="${prjPrdDtlId}" >
		            		<input name="prjPrdId" id="prjPrdId" type="hidden" class="ui-textbox"   value="${prjPrdId}" >
		            	   <input name="cstId" id="cstId" type="hidden" class="ui-textbox"  >
		            		<input name="lsPdUntCd" id="lsPdUntCd" type="hidden" class="ui-textbox"  >
		            		<input name="payWayCd" id="payWayCd" type="hidden" class="ui-textbox"  >
		            		 <input name="intRateWayCd" id="intRateWayCd" type="hidden" class="ui-textbox"  >
		            		 <input name="dpstHdlWayCd" id="dpstHdlWayCd" type="hidden" class="ui-textbox"  >
		            		 <input name="expHdlWayCd" id="expHdlWayCd" type="hidden" class="ui-textbox"  >
		            		 <input name="noPayWayCd" id="noPayWayCd" type="hidden" class="ui-textbox"  >
		            		  <input name="lsCoe" id="lsCoe" type="hidden" class="ui-textbox"  >
		            		   <input name="lsCalWayCd" id="lsCalWayCd" type="hidden" class="ui-textbox"  >
		                    </div>
		                </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">融资租赁合同号</div>
		                    <div class="field">
		                       <span id="lsCntNo"></span>
		                    </div>
		                </div>
		                  <div class="fieldBox col_33">
		                    <div class="label">承租人</div>
		                    <div class="field">
		                        <span id="cstNm" name="cstNm"></span>
		                    </div>
		                </div>
		                  <div class="fieldBox col_33">
		                    <div class="label">项目名称</div>
		                    <div class="field">
		                          <span id="prjNm" name="prjNm"></span>
		                    </div>
		                </div>
		                  <div class="fieldBox col_33">
		                    <div class="label">供应商</div>
		                    <div class="field">
		                       <span id="splNm" name="splNm"></span>
		                    </div>
		                </div>
		               <div class="caption">
                                <span class="title">租赁物件清单</span>
                  	  </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">租赁物件名称</div>
		                    <div class="field">
		                    <span id="prdNm" name="prdNm"></span>
		                    </div>
		                </div> 
		                 <div class="fieldBox col_100">
		                    <div class="label">型号</div>
		                    <div class="field">
		                       <span id="prdMdl" name="prdMdl"></span>
								 </div>
		                </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">是否新车</div>
		                    <div class="field">
		                    <span id="isNewNm" name="isNewNm"></span>
		                    </div>
		                </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">使用期限(月)</div>
		                    <div class="field">
		                       <span id="usedPd" name="usedPd"></span>
		                    </div>
		                </div>
		                  <div class="fieldBox col_33">
		                    <div class="label">单价</div>
		                    <div class="field">
		                       <span id="prdAmt" name="prdAmt"></span>
		                    </div>
		                </div>
		                  <div class="fieldBox col_33">
		                    <div class="label">数量</div>
		                    <div class="field">
		                     <span id="prdQty" name="prdQty">1</span>
		                    </div>
		                </div>
		                 <div class="caption">
                                <span class="title">支付表信息</span>
                  	  </div>
		                <div class="fieldBox col_33">
		                    <div class="label">租赁物件总价值</div>
		                    <div class="field">
		                    <span id="totLsItmAmt" name="totLsItmAmt"></span>
		                    <input type="hidden" id="contAmt" name="contAmt"/>
		                    </div>
		                </div>
		                  <div class="fieldBox col_33">
		                    <div class="label">租赁期数</div>
		                    <div class="field">
		                    <span id="lsPd" name="lsPd"></span>
		                    </div>
		                </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">租赁周期</div>
		                    <div class="field">
		                     <span id="rentPeriod" name="rentPeriod"></span>
		                    </div>
		                </div>
		                
		                   <div class="fieldBox col_33">
		                    <div class="label">租赁年利率</div>
		                    <div class="field">
		                      <span id="annIntRatePct" name="annIntRatePct"></span>
		                    </div>
		                </div>
		                   <div class="fieldBox col_33">
		                    <div class="label">实际融资租赁价值</div>
		                    <div class="field">
		                        <span id="actLsAmt" name="actLsAmt"></span>
		                    </div>
		                </div>
		               <div class="fieldBox col_33">
		                    <div class="label">租赁年利率计算方式</div>
		                    <div class="field">
		                       <span id="intRateWayCdNm" name="intRateWayCdNm"></span>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">客户保证金处理方式</div>
		                    <div class="field">
		                      <span id="dpstHdlWayCdNm" name="dpstHdlWayCdNm"></span>
		                    </div>
		                </div>
		                <div class="fieldBox col_33">
		                    <div class="label">租赁期满处理方式</div>
		                    <div class="field">
		                        <span id="expHdlWayCdNm" name="expHdlWayCdNm"></span>
		                    </div>
		                </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">支付方式</div>
		                    <div class="field">
		                    	 <span id="payWayCdNm" name="payWayCdNm"></span>
		                    </div>
		                </div>
		                
		                  <div class="fieldBox col_33">
		                    <div class="label">首付款</div>
		                    <div class="field">
		                    <span id="firstPayAmt"></span>
		                    </div>
		                </div>
				        <div class="fieldBox col_100">
				            <div class="sqPanel">
				                <div id="detailGrid">
				                    <div id="ligergrid_fee" class="sq-grid"></div>
				                </div>
				            </div>
				        </div>
				          <div class="fieldBox col_100">
				            <div class="sqPanel">
				                <div id="feePayGrid">
				                    <div id="ligergrid_calculate" class="sq-grid"></div>
				                </div>
				            </div>
				        </div>
				         <div class="fieldBox col_33">
		                    <div class="label">合计租金：</div>
		                    <div class="field">
		                    <span id="totalRntAmt"></span>
		                    </div>
		                </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">合计本金：</div>
		                    <div class="field">
		                    <span id="totalPrinAmt"></span>
		                    </div>
		                </div>
		                 <div class="fieldBox col_33">
		                    <div class="label">合计利息：</div>
		                    <div class="field">
		                    <span id="totalIntAmt"></span>
		                    </div>
		                </div>
	                </div>
	            </form>
		</div>
	</div>
</div>

<script type="text/javascript">
var feeGrid;//费用明细信息
var quatId = '${quatId}';
var prjId = '${prjId}';
var calculateGrid;
var annIntRatePct = 0;
$(function(){
	$('#formSet1').ligerForm({
        validate : true
	});
	initPrjPrdQuatData();
});


function prjQuatPrpsfeeGrid(data){
	feeGrid = $("#ligergrid_fee").ligerGrid({
        data: data,
        columns: [
            {display: '费用类型', name: 'feeTypCdNm', minWidth: 80},
            {display: '是否为固定值', name: 'isFixedAmtNm', minWidth: 80},
            {display: '计算基数', name: 'calBaseCdNm', minWidth: 80},
            {display: '比例值（%）', name: 'feePct', minWidth: 80, type: 'numberbox' },
            {display: '金额', name: 'feeAmt',render:renderAmt, minWidth: 80, type: 'numberbox'},
            {display: '计入方式', name: 'cntWayCdNm', minWidth: 80}
        ],
        usePager: false,
        root: 'rows',
        record: 'total',
        hideLoadButton: true,
        width: '100%',
        height: 300,
        heightDiff: -2,
        enabledEdit: false,
        isScroll: false,
        checkbox: false,
        rownumbers: true,
        allowUnSelectRow: true,
        alternatingRow: true
    });
}
	
//初始化数据
function initPrjPrdQuatData(){
	var params = {};
	params.prjId=$("#prjId").val();
	params.prjPrdDtlId = $("#prjPrdDtlId").val();
	params.prjPrdId = $("#prjPrdId").val();
	params.id = $("#prjPrdQuatId").val();
	$.ajax({
		type: 'get',
		dataType:'json',
		data:params,
		url: '<%=path%>/project/prjPrdPaySchTM/getById.do',
		success:function(msg){
			 if(msg.success == 1){
				 if(msg.data){
					 setInitData(msg.data);
				 }
			 }
		}
	});
}

	function setInitData(prjQuatPrps){
		//初始化修改数据
	 	 var form = liger.get("formSet1");
	 	$("#totLsItmAmt").text(prjQuatPrps.totLsItmAmt==null?"":prjQuatPrps.totLsItmAmt);
	 	$("#contAmt").val(prjQuatPrps.contAmt==null?"":prjQuatPrps.contAmt);
	 	$("#lsPd").text(prjQuatPrps.lsPd==null?"":prjQuatPrps.lsPd);
	 	$("#annIntRatePct").text(prjQuatPrps.annIntRatePct==null?"":prjQuatPrps.annIntRatePct);
//	 	$("#intRateRsPct").text(prjQuatPrps.intRateRsPct==null?"":prjQuatPrps.intRateRsPct);
	    $("#actLsAmt").text(prjQuatPrps.actLsAmt==null?"":prjQuatPrps.actLsAmt);
	    $("#intRateWayCdNm").text(prjQuatPrps.intRateWayCdNm);
		$("#dpstHdlWayCdNm").text(prjQuatPrps.dpstHdlWayCdNm);
		$("#expHdlWayCdNm").text(prjQuatPrps.expHdlWayCdNm);
		 $("#noPayWayCdNm").text(prjQuatPrps.noPayWayCdNm);
		 $("#payWayCdNm").text(prjQuatPrps.payWayCdNm);
		 $("#cstId").val(prjQuatPrps.cstId==null?"":prjQuatPrps.cstId);
		 $("#lsPdUntCd").val(prjQuatPrps.lsPdUntCd==null?"":prjQuatPrps.lsPdUntCd);
		 $("#payWayCd").val(prjQuatPrps.payWayCd==null?"":prjQuatPrps.payWayCd);
		 $("#intRateWayCd").val(prjQuatPrps.intRateWayCd);
		 $("#dpstHdlWayCd").val(prjQuatPrps.dpstHdlWayCd);
		 $("#expHdlWayCd").val(prjQuatPrps.expHdlWayCd);
		 $("#noPayWayCd").val(prjQuatPrps.noPayWayCd);
		 $("#lsCalWayCd").val(prjQuatPrps.lsCalWayCd);
		 $("#paySchNo").text(prjQuatPrps.paySchNo==null?"":prjQuatPrps.paySchNo);
	 		if(prjQuatPrps.prjBscInfo){
	 				$("#cstNm").text(prjQuatPrps.prjBscInfo.cstNm==null?"":prjQuatPrps.prjBscInfo.cstNm);
		 		$("#prjNm").text(prjQuatPrps.prjBscInfo.prjNm==null?"":prjQuatPrps.prjBscInfo.prjNm);
				$("#splNm").text(prjQuatPrps.prjPrdBscInfo.splNm==null?"":prjQuatPrps.prjPrdBscInfo.splNm);
				//合同号
				$("#lsCntNo").text(prjQuatPrps.prjBscInfo.lsCntNo==null?"":prjQuatPrps.prjBscInfo.lsCntNo);
	 		}
			if(prjQuatPrps.prjPrdBscInfo){
				$("#prdNm").text(prjQuatPrps.prjPrdBscInfo.prdNm==null?"":prjQuatPrps.prjPrdBscInfo.prdNm);
				if(prjQuatPrps.dtlVO){
					$("#prdMdl").text(prjQuatPrps.dtlVO.prdMdl==null?"":prjQuatPrps.dtlVO.prdMdl);
				}else{
		 		$("#prdMdl").text(prjQuatPrps.prjPrdBscInfo.prdMdl==null?"":prjQuatPrps.prjPrdBscInfo.prdMdl);
				}
				$("#isNewNm").text(prjQuatPrps.prjPrdBscInfo.isNewNm==null?"":prjQuatPrps.prjPrdBscInfo.isNewNm);
				$("#usedPd").text(prjQuatPrps.prjPrdBscInfo.usedPd==null?"":prjQuatPrps.prjPrdBscInfo.usedPd);
				$("#prdAmt").text(prjQuatPrps.prjPrdBscInfo.guidePc==null?"":prjQuatPrps.prjPrdBscInfo.guidePc);
				$("#rentPeriod").text(prjQuatPrps.lsPdUntCdNm);
	 		} 
	 		$("#firstPayAmt").text(prjQuatPrps.firstPayAmt);
	 		$("#totalRntAmt").text(prjQuatPrps.totalRntAmt);
			$("#totalPrinAmt").text(prjQuatPrps.totalPrinAmt);
			$("#totalIntAmt").text(prjQuatPrps.totalIntAmt);
			annIntRatePct = prjQuatPrps.annIntRatePct;
	 		initCalculatePage(prjQuatPrps.prjQuatPrpsPaySchPage);
	 		prjQuatPrpsfeeGrid(prjQuatPrps.feeDetailListPage);
	}


	function initCalculatePage(data){
			 var prpsId=$("#prpsId").val();
		 	calculateGrid = $("#ligergrid_calculate").ligerGrid({
			data:data,
		     columns: [
		         { display: '应还款时间', name: 'payDt', render:renderDate, minWidth: 60 },
		         { display: '期次', name: 'payPd',minWidth: 140},
		         { display: '租金', name: 'rntAmt', minWidth: 140,render:renderAmt, type:'currency',enabledSort:true},
		         { display: '本金', name: 'prinAmt', minWidth: 60, render:renderAmt, type:'currency'},
		         { display: '利息', name: 'intAmt', minWidth: 140, render:renderAmt, type:'currency' },
		         { display: '剩余本金', name: 'remPrinAmt', minWidth: 140, render:renderAmt, type:'currency' },
		     ],
		     usePager: false,
		     pageSize:10,
		     root:'rows',
		     record:'total',
		     hideLoadButton : true,
		     width: '100%',
		     height:300,
		     heightDiff:-2,
		     //isScroll: false,
		     checkbox:false,
		     enabledEdit: false,
		     rownumbers:true
		});
	}
	
	//格式化为人民币格式
	function renderAmt(rowdata, rowindex, value) {
		if(typeof value =='number'){
        var h="￥" + FormatMoney((parseFloat(value)).toFixed(2));
        return h;
		}
    }
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}
</script>



</body>
</html>
